﻿using System;
using System.Collections.Generic;
using Habanero.Base;
using Habanero.BO;
using Habanero.BO.ClassDefinition;
using Habanero.BO.Loaders;
using Habanero.UI.Base;
using Habanero.UI.Win;
using UseCaseManager.BO;
using NUnit.Framework;
using UseCaseManager.Test.BO;
using UseCaseManager.UI;
namespace UseCaseManager.Test.UI
{
    /// <summary>
    /// This is a test class for <see cref="ProjectsGridControl"/>
    /// </summary>
    [TestFixture]
    public class TestProjectsGridControl
    {
        [TestFixtureSetUp]
        public void SetupTestFixture()
        {
            //Executes once for all tests in this fixture
            ClassDef.ClassDefs.Clear();
            ClassDef.LoadClassDefs(new XmlClassDefsLoader(BOBroker.GetClassDefsXml(), new DtdLoader()));
        }

        [SetUp]
        public void TestSetup()
        {
            //Test Setup runs prior to each test in this fixture executing.
            BORegistry.DataAccessor = new DataAccessorInMemory();
            TestUtils.ClearAllTables();
            BusinessObjectManager.Instance.ClearLoadedObjects();
            TestUtils.WaitForGC();
            GlobalUIRegistry.ControlFactory = new ControlFactoryWin();
        }

        [Test]
        public void Test_CreateProjectsGridControl()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            ProjectsGridControl projectsGridControl = new ProjectsGridControl(GlobalUIRegistry.ControlFactory);
            //---------------Test Result -----------------------
            Assert.IsNotNull(projectsGridControl);
        }
    }
}
